<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<?php 

	$userID = $_POST["users_idNum"];
	$userID = intval($userID);
//	$complaint = $_POST["complaints_complaint"];
	$ses_id = session_id();
	include("../../database/connect.php");
	$userInfo = mysql_query("SELECT * FROM users WHERE idNum='$userID'");
	$info = mysql_fetch_array($userInfo);
	$habitsInfo = mysql_query("SELECT * FROM habits WHERE idNum='$userID'");
	$habits = mysql_fetch_array($habitsInfo);
	$momInfo = mysql_query("SELECT * FROM moms WHERE idNum='$userID'");
	$mom = mysql_fetch_array($momInfo);
	$dadInfo = mysql_query("SELECT * FROM dads WHERE idNum='$userID'");
	$dad = mysql_fetch_array($dadInfo);
	$sibsInfo = mysql_query("SELECT * FROM siblings WHERE idNum='$userID'");
	$siblings = mysql_fetch_array($sibsInfo);
	
	
	$dadLine = ($dad['alive'] ? ("בחיים, " . ($dad['background'] ? ("סובל מ" . $dad['diseases']) : "בריא")) : ("נפטר בגיל " . $dad['deathAge'] . " כתתוצאה מ" . $dad['deathCause'] . "<br />" . ($dad['background'] ? ("סבל מ" . $dad['diseases']) : "")));
	$momLine = ($mom['alive'] ? ("בחיים, " . ($mom['background'] ? ("סובלת מ" . $mom['diseases']) : "בריאה")) : ("נפטרה בגיל " . $mom['deathAge'] . " כתתוצאה מ" . $mom['deathCause'] . "<br />" . ($mom['background'] ? ("סבלה מ" . $mom['diseases']) : "")));
	
    $sibsLine1 = ($siblings['healthy'] ? "בריאים" : "סובלים מ" . $siblings['diseases'] . "<br />");
	$sibsLine2 = $siblings['death'] ? (($siblings['gender'] == 'male' ? "אח נפטר בגיל " : "אחות נפטרה בגיל ") . $siblings['deathAge'] . " כתוצאה מ" . $siblings['deathCause']) : "";
	
	$smoking_quantity = $habits['smokingQuantity']=="packs" ? "חפיסות" : "סיגריות";
	switch ($habits['smoking'])
	{
		case 'yes':
			$smoking = $habits['yearsSmoking'] . " שנים, " . $habits['numSigsPerDay'] . " " . $smoking_quantity . " ביום.";
			break;
		case 'quit':
			$smoking = "הפסיק\ה לפני " . $habits['yearsquit'] . " שנים אחרי שעישן\ה " . $habits['yearsSmoking'] . " שנים.";
			break;
		default:
			$smoking = "לא מעשן";
			break;
	}
    
	$drinking = ($habits['alcohol'] ? ($habits['drinkingfreq']=='daily' ? "יומיומי" : "חברתי") : "לא");
	$drugs = $habits['druguse'] ? ($habits['drugtype'] . ". באופן " . ($habits['usingfreq']=='daily' ? "יומיומי" : "חברתי")) : "לא";
	$exercise = $habits['activity'];
	
	$meds = $info['Sensitivities'];
	$allergies = $info['Allergies'];
?>

<body>
	
    <div>
	<p>
    	<a class="field">רקע משפחתי<br /></a>
    	<a class="entry"> <?php echo "<b>אב</b>: " . $dadLine . "<br />"?></a>
	   	<a class="entry"> <?php echo "<b>אם</b>: " . $momLine . "<br />"?></a>        
    	<a class="entry"> <?php echo "<b>אחים</b>: " . $sibsLine1?></a>
	   	<a class="entry"> <?php echo $sibsLine2 . "<br />"?></a>        
    <p>
    </div>
    <div>
    <p>
    	<a class="field">הרגלים<br /></a>
    	<a class="entry"> <?php echo "<b>עישון</b>: " . $smoking . "<br />"?></a>
        <a class="entry"> <?php echo "<b>שתיה</b>: " . $drinking . "<br />"?></a>
        <a class="entry"> <?php echo "<b>סמים</b>: " . $drugs . "<br />"?></a>
		<a class="entry"> <?php echo "<b>פעילות גופנית</b>: " . $exercise . "<br />"?></a>
    <p>
    </div>
    <div>
    <p>
    	<a class="field">רגישויות<br /></a>
    	<a class="redText"> <?php echo "<b>תרופות</b>: " . $meds . "<br />"?></a>
        <a class="redText"> <?php echo "<b>אלרגיות</b>: " . $allergies . "<br />"?></a>
    <p>
    </div>
</body>
</html>